package homework.Day0328;

import java.util.Arrays;

public class Recursion {

    public static void main(String[] args) {
        String str = "一二三四五";
        System.out.println(str);
        System.out.println(charReverse(str,0));
    }

    public static String charReverse(String str , int i){
        char[] chars = str.toCharArray();
        if (i == chars.length/2){
            return str;
        }
        char temp = chars[i];
        chars[i] = chars[chars.length - i - 1];
        chars[chars.length - i - 1] = temp;
        str = new String(chars);
        i++;
        return charReverse(str,i);
    }

}
